const path = require('path')
const HTMLWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
module.exports = {
  mode: 'development',
  entry: {
    app: './src/index.js'
  },
  output: {
    path: path.resolve(__dirname, '../', 'build'),
    filename: '[name].[hash:8].js'
  },
  plugins: [
    // new CleanWebpackPlugin(), // 清除之前打包的文件
    new CleanWebpackPlugin({
      verbose: true // 显示清除日志
    }),
    new HtmlWebpackPlugin({
      template: './public/index.html',
      title: 'webpack 神奇之旅'
    })
  ]
}